package com.inossem.warehousestorage_inossem.utils;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

import com.google.gson.Gson;
import com.inossem.utils.base.Utils;
import com.inossem.utils.constant.UtilsConstant;
import com.inossem.utils.listener.NoDoubleClickListener;
import com.inossem.utils.log.LogUtils;
import com.inossem.warehousestorage_inossem.R;
import com.inossem.warehousestorage_inossem.activity.base.BaseActivity;
import com.inossem.warehousestorage_inossem.adapter.OverviewAdapter;
import com.inossem.warehousestorage_inossem.bean.common.GetOperatorBean;
import com.inossem.warehousestorage_inossem.bean.common.GetOperatorGroupBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageAllocatingConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageAllocatingGetListRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageAllocatingOverviewBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageFreeBaseInfoBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageFreeConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageFreeOverviewBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageOperatorBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageOtherBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageOtherConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageOtherOverviewBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageReceiveAddOperatorUserGroupBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageReceiveConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageReceiveOverviewBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageTenderBaseInfoBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageTenderConfirmRequestBean;
import com.inossem.warehousestorage_inossem.bean.inStorage.InStorageTenderOverviewBean;
import com.inossem.warehousestorage_inossem.dialog.DialogUtils;
import com.jzxiang.pickerview.TimePickerDialog;
import com.jzxiang.pickerview.data.Type;
import com.jzxiang.pickerview.listener.OnDateSetListener;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by leij on 2017/7/5.
 */

public class InStorageUtils {

    private static final String TYPE_EDITTEXT = "0";

    private static final String TYPE_TIME = "1";

    private static final String TYPE_SPINNER = "2";

    private static final String REQUIRED_TRUE = "1";

    private static final String REQUIRED_FALSE = "2";

    private static final String IS_FOCUS_TRUE = "1";  //允许修改过账日期

    private static final String IS_FOCUS_FALSE = "0";//不允许修改过账日期

    public static final int NO_BATCH = -1;//没有批次信息

    public static final int BATCH_NO_MESSAGE = 0;//批次信息无信息

    public static final int BATCH_HAS_MESSAGE = 1;//批次信息有信息

    public static final int BATCH_NO_MESSAGE_BUT_REQUIRED = 2;//批次信息无信息,但是必填

    //检查验收入库批次特性必填项是否有未填写的
    public static int checkReceiveBatchInfo(Context context) {
        int result = -1;
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> receiveInStorageList = getInStorageReceiveOverviewBean(context).getData().getReceiveInStorageList();
        if (receiveInStorageList != null && !receiveInStorageList.isEmpty()) {
            for (int i = 0; i < receiveInStorageList.size(); i++) {
                InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean receiveInStorageItem = receiveInStorageList.get(i);
                List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean> batchList = receiveInStorageItem.getBatch();
                for (int j = 0; j < batchList.size(); j++) {
                    InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean batchBean = batchList.get(j);
//                    LogUtils.i("Name:" + batchBean.getName() + "---Text:" + batchBean.getText() + "---Value:" + batchBean.getValue());
                    if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                        if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getValue())) {
                            result = i + 1;
                            return result;
                        }
                    }
                }
            }
        }
        return result;
    }
    //检查调拨入库批次特性必填项是否有未填写的
    public static int checkAllocatingBatchInfo(Context context) {
        int result = -1;
        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> receiveInStorageList = getInStorageAllocatingOverviewBean(context).getBody().getItem_list();
        if (receiveInStorageList != null && !receiveInStorageList.isEmpty()) {
            for (int i = 0; i < receiveInStorageList.size(); i++) {
                InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean receiveInStorageItem = receiveInStorageList.get(i);
                List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchMaterialSpecListBean> batchList = receiveInStorageItem.getBatch_material_spec_list();
                for (int j = 0; j < batchList.size(); j++) {
                    InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchMaterialSpecListBean batchBean = batchList.get(j);
//                    LogUtils.i("Name:" + batchBean.getName() + "---Text:" + batchBean.getText() + "---Value:" + batchBean.getValue());
                    if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                        if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                            result = i + 1;
                            return result;
                        }
                    }
                }
                List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean> batchList1 = receiveInStorageItem.getBatch_spec_list();
                for (int j = 0; j < batchList1.size(); j++) {
                    InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean batchBean = batchList1.get(j);
//                    LogUtils.i("Name:" + batchBean.getName() + "---Text:" + batchBean.getText() + "---Value:" + batchBean.getValue());
                    if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                        if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                            result = i + 1;
                            return result;
                        }
                    }
                }
            }
        }
        return result;
    }
    public static int checkFreeBatchInfo(Context context) {
        int result = -1;
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> list = getInStorageFreeOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean freeInStorageItem = list.get(i);
            List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean> batchList = freeInStorageItem.getBatch_material_spec_list();
            for (int j = 0; j < batchList.size(); j++) {
                InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean batchBean = batchList.get(j);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                        result = i + 1;
                        return result;
                    }
                }
            }
        }
        for (int i = 0; i < list.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean freeInStorageItem = list.get(i);
            List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> batchList = freeInStorageItem.getBatch_spec_list();
            for (int j = 0; j < batchList.size(); j++) {
                InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean batchBean = batchList.get(j);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                        result = i + 1;
                        return result;
                    }
                }
            }
        }
        return result;
    }

    public static int checkOtherBatchInfo(Context context) {
//        int result = -1;
//        List<InStorageOtherOverviewBean.DataBean.MaterielListBean> list = getInStorageOtherBean(context).getMaterielList();
//        for (int i = 0; i < list.size(); i++) {
//            InStorageOtherOverviewBean.DataBean.MaterielListBean otherInStorageItem = list.get(i);
//            List<InStorageOtherOverviewBean.DataBean.MaterielListBean.BatchBean> batchList = otherInStorageItem.getBatch();
//            for (int j = 0; j < batchList.size(); j++) {
//                InStorageOtherOverviewBean.DataBean.MaterielListBean.BatchBean batchBean = batchList.get(j);
//                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
//                    if ("".equals(batchBean.getText()) && "".equals(batchBean.getValue())) {
//                        result = i + 1;
//                        return result;
//                    }
//                }
//            }
//        }
//        return result;
        return 0;
    }

    public static int checkFreeInStorageNumber(Context context) {
        int result = -1;
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> list = getInStorageFreeOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean freeInStorageItem = list.get(i);
            if (TextUtils.isEmpty(freeInStorageItem.getInStorageNumber())) {
                result = i + 1;
                return result;
            }
        }
        return result;
    }

    //获取免检入库可提交行项目数量
    public static int getFreeInStorageConfirmNumber(Context context) {
        int result = 0;
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> list = getInStorageFreeOverviewBean(context).getBody().getItem_list();
        if (list == null) {
            return result;
        } else {
            for (int i = 0; i < list.size(); i++) {
                InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean freeInStorageItem = list.get(i);
                //验证批次特性
                boolean batchFlag = true;
                List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean> batchList = freeInStorageItem.getBatch_material_spec_list();
                for (int j = 0; j < batchList.size(); j++) {
                    InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean batchBean = batchList.get(j);
                    if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                        if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                            batchFlag = false;
                            break;
                        }
                    }
                }
                List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> batchList1 = freeInStorageItem.getBatch_spec_list();
                for (int j = 0; j < batchList1.size(); j++) {
                    InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean batchBean = batchList1.get(j);
                    if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                        if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                            batchFlag = false;
                            break;
                        }
                    }
                }
                if (!TextUtils.isEmpty(freeInStorageItem.getInStorageNumber()) && batchFlag) {
                    result = result + 1;
                }
            }
        }
        return result;
    }

    //获取招采入库可提交行项目数量
    public static int getTenderInStorageConfirmNumber(Context context) {
        int result = 0;
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> list = getInStorageTenderOverviewBean(context).getBody().getItem_list();
        if (list == null) {
            return result;
        } else {
            for (int i = 0; i < list.size(); i++) {
                InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean tenderInStorageItem = list.get(i);
                //验证批次特性
                boolean batchFlag = true;
                List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean> batchList = tenderInStorageItem.getBatch_material_spec_list();
                for (int j = 0; j < batchList.size(); j++) {
                    InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean batchBean = batchList.get(j);
                    if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                        if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                            batchFlag = false;
                            break;
                        }
                    }
                }
                if (batchFlag) {
                    List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> batchList1 = tenderInStorageItem.getBatch_spec_list();
                    for (int j = 0; j < batchList1.size(); j++) {
                        InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean batchBean = batchList1.get(j);
                        if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                            if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                                batchFlag = false;
                                break;
                            }
                        }
                    }
                }
                if (!TextUtils.isEmpty(tenderInStorageItem.getInStorageNumber()) && batchFlag) {
                    result = result + 1;
                }
            }
        }
        return result;
    }

    public static int getOtherInStorageConfirmNumber(Context context) {
        int result = 0;
        List<InStorageOtherOverviewBean.MaterielListBean> list = getInStorageOtherBean(context).getMaterielList();
        if (list == null) {
            return result;
        } else {
            for (int i = 0; i < list.size(); i++) {
                InStorageOtherOverviewBean.MaterielListBean otherInStorageItem = list.get(i);
                //验证批次特性
                boolean batchFlag = true;
                List<InStorageOtherOverviewBean.MaterielListBean.BatchMaterialSpecListBean> batchList = otherInStorageItem.getBatch_material_spec_list();
                for (int j = 0; j < batchList.size(); j++) {
                    InStorageOtherOverviewBean.MaterielListBean.BatchMaterialSpecListBean batchBean = batchList.get(j);
                    if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                        if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                            batchFlag = false;
                            break;
                        }
                    }
                }
                if (batchFlag) {
                    List<InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean> batchMaterialSpecList = otherInStorageItem.getBatch_spec_list();
                    for (int j = 0; j < batchMaterialSpecList.size(); j++) {
                        InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean batchBean = batchMaterialSpecList.get(j);
                        if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                            if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                                batchFlag = false;
                                break;
                            }
                        }
                    }
                }
                if (!TextUtils.isEmpty(otherInStorageItem.getInStorageNumber()) && batchFlag) {
                    result = result + 1;
                }
            }
        }
        return result;
    }

//    public static int checkFreeInStorage(Context context) {
//        int result = -1;
//        List<InStorageFreeOverviewBean.DataBean.FreeInStorageListBean> list = getInStorageFreeOverviewBean(context).getData().getFreeInStorageList();
//        for (int i = 0; i < list.size(); i++) {
//            InStorageFreeOverviewBean.DataBean.FreeInStorageListBean freeInStorageItem = list.get(i);
//            if (!TextUtils.isEmpty(freeInStorageItem.getInStorageNumber())) {
//                List<InStorageFreeOverviewBean.DataBean.FreeInStorageListBean.BatchBean> batchList = freeInStorageItem.getBatch();
//                for (int j = 0; j < batchList.size(); j++) {
//                    InStorageFreeOverviewBean.DataBean.FreeInStorageListBean.BatchBean batchBean = batchList.get(j);
//                    if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
//                        if ("".equals(batchBean.getText()) && "".equals(batchBean.getValue())) {
//                            result = i + 1;
//                            return result;
//                        }
//                    }
//                }
//            }
//        }
//        return result;
//    }

    public static int checkOtherInStorageNumber(Context context) {
        int result = -1;
        List<InStorageOtherOverviewBean.MaterielListBean> list = getInStorageOtherBean(context).getMaterielList();
        for (int i = 0; i < list.size(); i++) {
            InStorageOtherOverviewBean.MaterielListBean otherInStorageItem = list.get(i);
            if (TextUtils.isEmpty(otherInStorageItem.getInStorageNumber())) {
                result = i + 1;
                return result;
            }
        }
        return result;
    }

    //验收入库批次是否有必填项
    public static boolean hasReceiveBatchRequired(List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean> list) {
        if (list == null || list.isEmpty()) {
            return false;
        } else {
            for (int i = 0; i < list.size(); i++) {
                InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean batchBean = list.get(i);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    return true;
                }
            }
        }
        return false;
    }
    //调拨入库批次是否有必填项
    public static boolean hasRAllocatingBatchRequired(List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchMaterialSpecListBean> list,
                                                      List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean> list1 ) {
        if (list == null || list.isEmpty()) {
            return false;
        } else {
            for (int i = 0; i < list.size(); i++) {
                InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchMaterialSpecListBean batchBean = list.get(i);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    return true;
                }
            }
            for (int i = 0; i < list1.size(); i++) {
                InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean batchBean = list1.get(i);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    return true;
                }
            }
        }
        return false;
    }
    //免检入库批次是否有必填项
    public static boolean hasFreeBatchRequired(List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean> list,
                                               List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> list1) {
        if (list == null || list.isEmpty()) {
            return false;
        } else {
            for (int i = 0; i < list.size(); i++) {
                InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean batchBean = list.get(i);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    return true;
                }
            }
            for (int i = 0; i < list1.size(); i++) {
                InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean batchBean = list1.get(i);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    return true;
                }
            }
        }
        return false;
    }

    //免检入库批次是否有必填项
    public static boolean hasTenderBatchRequired(List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean> list,
                                                 List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> list1) {
        if (list == null || list.isEmpty()) {
            return false;
        } else {
            for (int i = 0; i < list.size(); i++) {
                InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean batchBean = list.get(i);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    return true;
                }
            }
            for (int i = 0; i < list1.size(); i++) {
                InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean batchBean = list1.get(i);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    return true;
                }
            }
        }
        return false;
    }

    //其他入库批次是否有必填项
    public static boolean hasOtherBatchRequired(List<InStorageOtherOverviewBean.MaterielListBean.BatchMaterialSpecListBean> list , List<InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean> batchSpecListBeanList ) {
        if (list == null || list.isEmpty()) {
            return false;
        } else {
            for (int i = 0; i < list.size(); i++) {
                InStorageOtherOverviewBean.MaterielListBean.BatchMaterialSpecListBean batchBean = list.get(i);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    return true;
                }
            }
            for (int i = 0; i < batchSpecListBeanList.size(); i++) {
                InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean batchBean = batchSpecListBeanList.get(i);
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    return true;
                }
            }
        }
        return false;
    }

    public static int hasReceiveBatchInfo(List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean> list) {
        int result = NO_BATCH;
        if (list == null || list.isEmpty()) {
            return result;
        } else {
            result = BATCH_NO_MESSAGE;
            for (int i = 0; i < list.size(); i++) {
                InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean batchBean = list.get(i);
                String text = batchBean.getText();
                String value = batchBean.getValue();
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    result = BATCH_NO_MESSAGE_BUT_REQUIRED;
                }
                if (!TextUtils.isEmpty(text) || !TextUtils.isEmpty(value)) {
                    result = BATCH_HAS_MESSAGE;
                    break;
                }
            }
        }
        return result;
    }

    //免检入库是否有批次特性
//    public static int hasFreeBatchInfo(List<InStorageFreeOverviewBean.DataBean.FreeInStorageListBean.BatchBean> list) {
//        int result = NO_BATCH;
//        if (list == null || list.isEmpty()) {
//            return result;
//        } else {
//            result = BATCH_NO_MESSAGE;
//            for (int i = 0; i < list.size(); i++) {
//                InStorageFreeOverviewBean.DataBean.FreeInStorageListBean.BatchBean batchBean = list.get(i);
//                String text = batchBean.getText();
//                String value = batchBean.getValue();
//                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
//                    result = BATCH_NO_MESSAGE_BUT_REQUIRED;
//                }
//                if (!TextUtils.isEmpty(text) || !TextUtils.isEmpty(value)) {
//                    result = BATCH_HAS_MESSAGE;
//                    break;
//                }
//            }
//        }
//        return result;
//    }

    //招采入库是否有批次特性
    public static int hasTenderBatchInfo(List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> list) {
        int result = NO_BATCH;
        if (list == null || list.isEmpty()) {
            return result;
        } else {
            result = BATCH_NO_MESSAGE;
            for (int i = 0; i < list.size(); i++) {
                InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean batchBean = list.get(i);
                String text = batchBean.getText();
                String value = batchBean.getBatch_spec_value();
                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                    result = BATCH_NO_MESSAGE_BUT_REQUIRED;
                }
                if (!TextUtils.isEmpty(text) || !TextUtils.isEmpty(value)) {
                    result = BATCH_HAS_MESSAGE;
                    break;
                }
            }
        }
        return result;
    }

    public static int hasOtherBatchInfo(List<InStorageOtherOverviewBean.MaterielListBean.BatchMaterialSpecListBean> list) {
        int result = NO_BATCH;
//        if (list == null || list.isEmpty()) {
//            return result;
//        } else {
//            result = BATCH_NO_MESSAGE;
//            for (int i = 0; i < list.size(); i++) {
//                InStorageOtherOverviewBean.DataBean.MaterielListBean.BatchBean batchBean = list.get(i);
//                String text = batchBean.getText();
//                String value = batchBean.getValue();
//                if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
//                    result = BATCH_NO_MESSAGE_BUT_REQUIRED;
//                }
//                if (!TextUtils.isEmpty(text) || !TextUtils.isEmpty(value)) {
//                    result = BATCH_HAS_MESSAGE;
//                    break;
//                }
//            }
//        }
        return result;
    }

    //获取验收入库信息
    public static InStorageReceiveOverviewBean getInStorageReceiveOverviewBean(Context context) {
        String json = SPUtils.getReceiveInStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, InStorageReceiveOverviewBean.class);
    }

    //获取调拨入库信息
    public static InStorageAllocatingOverviewBean getInStorageAllocatingOverviewBean(Context context) {
        String json = SPUtils.getAllocatingInStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, InStorageAllocatingOverviewBean.class);
    }

    //获取免检入库信息
    public static InStorageFreeOverviewBean getInStorageFreeOverviewBean(Context context) {
        String json = SPUtils.getFreeInStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, InStorageFreeOverviewBean.class);
    }

    //获取招采入库信息
    public static InStorageTenderOverviewBean getInStorageTenderOverviewBean(Context context) {
        String json = SPUtils.getTenderInStorageInformation(context);
        Gson gson = new Gson();
        return gson.fromJson(json, InStorageTenderOverviewBean.class);
    }

    //保存免检入库信息
    public static void saveInStorageFreeOverviewBean(Context context, InStorageFreeOverviewBean bean) {
        Gson gson = new Gson();
        SPUtils.saveFreeInStorageInformation(context, gson.toJson(bean, InStorageFreeOverviewBean.class));
    }

    //保存其他入库信息
    public static void saveInStorageOtherBean(Context context, InStorageOtherBean bean) {
        Gson gson = new Gson();
        SPUtils.saveOtherInStorageInformation(context, gson.toJson(bean, InStorageOtherBean.class));
    }

    //保存招采入库信息
    public static void saveInStorageTenderOverviewBean(Context context, InStorageTenderOverviewBean bean) {
        Gson gson = new Gson();
        SPUtils.saveTenderInStorageInformation(context, gson.toJson(bean, InStorageTenderOverviewBean.class));
    }

    //获取其他入库信息
    public static InStorageOtherBean getInStorageOtherBean(Context context) {
        String json = SPUtils.getOtherInStorageInformation(context);
        if (TextUtils.isEmpty(json)) {
            return new InStorageOtherBean();
        } else {
            Gson gson = new Gson();
            return gson.fromJson(json, InStorageOtherBean.class);
        }
    }

    //过滤验收入库货品列表信息
    public static List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> getReceiveInStorageList(Context context, String materiel) {
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> receiveInStorageList = new ArrayList<>();
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> allReceiveInStorageList = getInStorageReceiveOverviewBean(context).getData().getReceiveInStorageList();
        for (int i = 0; i < allReceiveInStorageList.size(); i++) {
            InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean item = allReceiveInStorageList.get(i);
            if (item.getMaterielCode().contains(materiel) || item.getMaterielDescription().contains(materiel)) {
                receiveInStorageList.add(item);
                continue;
            }
        }
        return receiveInStorageList;
    }
    //过滤调拨入库货品列表信息
    public static List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> getRAllocatingInStorageList(Context context, String materiel) {
        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> receiveInStorageList = new ArrayList<>();
        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> allReceiveInStorageList = getInStorageAllocatingOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < allReceiveInStorageList.size(); i++) {
            InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean item = allReceiveInStorageList.get(i);
            if (item.getMat_code().contains(materiel) || item.getMat_name().contains(materiel)) {
                receiveInStorageList.add(item);
                continue;
            }
        }
        return receiveInStorageList;
    }
    //过滤免检入库货品列表信息
    public static List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> getFreeInStorageList(Context context, String materiel) {
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> freeInStorageList = new ArrayList<>();
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> allFreeInStorageList = getInStorageFreeOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < allFreeInStorageList.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean item = allFreeInStorageList.get(i);
            if (item.getMat_code().contains(materiel) || item.getMat_name().contains(materiel)) {
                freeInStorageList.add(item);
                continue;
            }
        }
        return freeInStorageList;
    }

    //过滤招采入库货品列表信息
    public static List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> getTenderInStorageList(Context context, String materiel) {
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> tenderInStorageList = new ArrayList<>();
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> allTenderInStorageList = getInStorageTenderOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < allTenderInStorageList.size(); i++) {
            InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean item = allTenderInStorageList.get(i);
            if (item.getMat_code().contains(materiel) || item.getMat_name().contains(materiel)) {
                tenderInStorageList.add(item);
                continue;
            }
        }
        return tenderInStorageList;
    }

    //获取验收入库行项目数量
    public static int getReceiveMaterielListSize(Context context) {
        return getInStorageReceiveOverviewBean(context).getData().getReceiveInStorageList().size();
    }

    //获取验调拨库行项目数量
    public static int getAllocatingMaterielListSize(Context context) {
        return getInStorageAllocatingOverviewBean(context).getBody().getItem_list().size();
    }
    //获取免检入库行项目数量
    public static int getFreeMaterielListSize(Context context) {
        return getInStorageFreeOverviewBean(context).getBody().getItem_list().size();
    }

    //获取招采入库行项目数量
    public static int getTenderMaterielListSize(Context context) {
        return getInStorageTenderOverviewBean(context).getBody().getItem_list().size();
    }

    //获取其他入库行项目数量
    public static int getOtherMaterielListSize(Context context) {
        return getInStorageOtherBean(context).getMaterielList().size();
    }

    //通过序号获取验收入库的索引
    public static int getReceiveIndexBySerial(Context context, String serialNumber) {
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> list = getInStorageReceiveOverviewBean(context).getData().getReceiveInStorageList();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getSerial().equals(serialNumber)) {
                return i;
            }
        }
        return -1;
    }

    //通过序号获取免检入库的索引
    public static int getFreeIndexBySerial(Context context, String serialNumber) {
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> list = getInStorageFreeOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getStock_input_rid().equals(serialNumber)) {
                return i;
            }
        }
        return -1;
    }

    //通过序号获取招采入库的索引
    public static int getTenderIndexBySerial(Context context, String serialNumber) {
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> list = getInStorageTenderOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getStock_input_rid().equals(serialNumber)) {
                return i;
            }
        }
        return -1;
    }

    //通过物料编码获取验收入库第一个查询到的索引
    public static int getReceiveIndexByMaterielCode(Context context, String materielCode) {
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> list = getInStorageReceiveOverviewBean(context).getData().getReceiveInStorageList();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getMaterielCode().equals(materielCode)) {
                return i;
            }
        }
        return -1;
    }
    //通过id获取验调拨入库第一个查询到的索引
    public static int getAllocatingIndexByMaterielCode(Context context, String materielCode) {
        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> list = getInStorageAllocatingOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getStock_input_rid().equals(materielCode)) {
                return i;
            }
        }
        return -1;
    }
    //通过物料编码获取免检入库第一个查询到的索引
    public static int getFreeIndexByMaterielCode(Context context, String materielCode) {
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> list = getInStorageFreeOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getMat_code().equals(materielCode)) {
                return i;
            }
        }
        return -1;
    }

    //通过物料编码获取招采入库第一个查询到的索引
    public static int getTenderIndexByMaterielCode(Context context, String materielCode) {
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> list = getInStorageTenderOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getMat_code().equals(materielCode)) {
                return i;
            }
        }
        return -1;
    }

    //通过物料编码获取其他入库第一个查询到的索引
    public static int getOtherIndexByMaterielCode(Context context, String materielCode) {
        List<InStorageOtherOverviewBean.MaterielListBean> list = getInStorageOtherBean(context).getMaterielList();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getMat_code().equals(materielCode)) {
                return i;
            }
        }
        return -1;
    }

    //获取验收入库该索引的行项目信息
    public static InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean getReceiveMaterielInformationByIndex(Context context, int index) {
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> list = getInStorageReceiveOverviewBean(context).getData().getReceiveInStorageList();
        if (list != null & !list.isEmpty() && list.size() >= index) {
            return list.get(index);
        } else {
            return null;
        }
    }
    //获取调拨入库该索引的行项目信息
    public static InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean getAllocatingMaterielInformationByIndex(Context context, int index) {
        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> list = getInStorageAllocatingOverviewBean(context).getBody().getItem_list();
        if (list != null & !list.isEmpty() && list.size() >= index) {
            return list.get(index);
        } else {
            return null;
        }
    }
    //获取免检入库该索引的行项目信息
    public static InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean getFreeMaterielInformationByIndex(Context context, int index) {
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> list = getInStorageFreeOverviewBean(context).getBody().getItem_list();
        if (list != null & !list.isEmpty() && list.size() >= index) {
            return list.get(index);
        } else {
            return null;
        }
    }

    //获取招采入库该索引的行项目信息
    public static InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean getTenderMaterielInformationByIndex(Context context, int index) {
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> list = getInStorageTenderOverviewBean(context).getBody().getItem_list();
        if (list != null & !list.isEmpty() && list.size() >= index) {
            return list.get(index);
        } else {
            return null;
        }
    }

    //获取其他入库该索引的行项目信息
    public static InStorageOtherOverviewBean.MaterielListBean getOtherMaterielInformationByIndex(Context context, int index) {
        List<InStorageOtherOverviewBean.MaterielListBean> list = getInStorageOtherBean(context).getMaterielList();
        if (list != null & !list.isEmpty() && list.size() >= index) {
            return list.get(index);
        } else {
            return null;
        }
    }

    //获取该序号的行项目信息
    public static InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean getReceiveMaterielInformationBySerial(Context context, String serialNumber) {
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> list = getInStorageReceiveOverviewBean(context).getData().getReceiveInStorageList();
        for (int i = 0; i < list.size(); i++) {
            InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean item = list.get(i);
            if (serialNumber.equals(item.getSerial())) {
                return item;
            }
        }
        return null;
    }

    //获取调拨入库该id的行项目信息
    public static InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean getAllocatingMaterielInformationBySerial(Context context, String id) {
        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> list = getInStorageAllocatingOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean item = list.get(i);
            if (id.equals(item.getAllocate_item_id())) {
                return item;
            }
        }
        return null;
    }
    //通过序号获取免检入库物料明细
    public static InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean getFreeMaterielInformationBySerial(Context context, String serialNumber) {
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> list = getInStorageFreeOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean item = list.get(i);
            if (serialNumber.equals(item.getStock_input_rid())) {
                return item;
            }
        }
        return null;
    }

    //通过序号获取招采入库物料明细
    public static InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean getTenderMaterielInformationBySerial(Context context, String serialNumber) {
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> list = getInStorageTenderOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < list.size(); i++) {
            InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean item = list.get(i);
            if (serialNumber.equals(item.getStock_input_rid())) {
                return item;
            }
        }
        return null;
    }

    public static InStorageOtherOverviewBean.MaterielListBean getOtherMaterielInformationByMaterielCode(Context context, String materielCode) {
        List<InStorageOtherOverviewBean.MaterielListBean> list = getInStorageOtherBean(context).getMaterielList();
        for (int i = 0; i < list.size(); i++) {
            InStorageOtherOverviewBean.MaterielListBean item = list.get(i);
            if (materielCode.equals(item.getMat_code())) {
                return item;
            }
        }
        return null;
    }

    public static List<InStorageReceiveOverviewBean.DataBean.InventoryAddressListBean> getReceiveInventoryAddressList(Context context) {
        List<InStorageReceiveOverviewBean.DataBean.InventoryAddressListBean> result = getInStorageReceiveOverviewBean(context).getData().getInventoryAddressList();
        return result;
    }

    //获取免检入库库存地点列表
    public static List<InStorageFreeBaseInfoBean.BaseInfoBean.FtyListBean.LocationAryBean> getFreeInventoryAddressList(Context context , String serialNumberStr) {
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> result = getInStorageFreeOverviewBean(context).getBody().getItem_list();
        String fty_id = null;
        List<InStorageFreeBaseInfoBean.BaseInfoBean.FtyListBean.LocationAryBean> locationAryBeanList = null;
        for (int i = 0; i < result.size(); i++) {
            if (serialNumberStr.equals(result.get(i).getStock_input_rid())) {
                fty_id = result.get(i).getFty_id();
                break;
            }
        }

        Gson gson = new Gson();
        InStorageFreeBaseInfoBean baseInfoBean = gson.fromJson(SPUtils.getFreeInStorageBaseInfo(context) , InStorageFreeBaseInfoBean.class);
        List<InStorageFreeBaseInfoBean.BaseInfoBean.FtyListBean> ftyListBeanList = baseInfoBean.getBody().getFty_list();
        for (int i = 0; i < ftyListBeanList.size(); i++) {
            if (ftyListBeanList.get(i).getFty_id().equals(fty_id)) {
                locationAryBeanList = ftyListBeanList.get(i).getLocation_ary();
                break;
            }

        }
        return locationAryBeanList;
    }

    //获取招采入库库存地点列表
    public static List<InStorageTenderBaseInfoBean.FtyBean.LocationAryBean> getTenderInventoryAddressList(Context context , String serialNumberStr) {
        LogUtils.i("serialNumberStr ==== " + serialNumberStr);
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> result = getInStorageTenderOverviewBean(context).getBody().getItem_list();
        String fty_id = null;
        List<InStorageTenderBaseInfoBean.FtyBean.LocationAryBean> locationAryBeanList = null;
        for (int i = 0; i < result.size(); i++) {
            if (serialNumberStr.equals(result.get(i).getStock_input_rid())) {
                fty_id = result.get(i).getFty_id();
                break;
            }
        }
        LogUtils.i("fty_id ==================== " + fty_id);
        Gson gson = new Gson();
        InStorageTenderBaseInfoBean baseInfoBean = gson.fromJson(SPUtils.getTenderInStorageBaseInfo(context) , InStorageTenderBaseInfoBean.class);
        List<InStorageTenderBaseInfoBean.FtyBean> ftyListBeanList = baseInfoBean.getBody();
        for (int i = 0; i < ftyListBeanList.size(); i++) {
            LogUtils.i("fty_id ==== " + ftyListBeanList.get(i).getFty_id());
            if (ftyListBeanList.get(i).getFty_id().equals(fty_id)) {
                locationAryBeanList = ftyListBeanList.get(i).getLocation_ary();
                break;
            }

        }
        return locationAryBeanList;
    }

    public static void createEditText(Context context, ViewGroup viewGroup, String name, boolean required, String text, String value, int id) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.view_in_storage_edittext, null);
        view.setId(id);
        TextView nameTextView = (TextView) view.findViewById(R.id.name);
        EditText textEditText = (EditText) view.findViewById(R.id.text);
        if (required) {
            String nameStr = name + "*";
            SpannableStringBuilder builder = new SpannableStringBuilder(nameStr);
            ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.RED);
            builder.setSpan(redSpan, nameStr.length() - 1, nameStr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            nameTextView.setText(builder);
        } else {
            nameTextView.setText(name);
        }
        textEditText.setText(text);
        viewGroup.addView(view);
    }

    public static void creatHorizontalView (Context context, ViewGroup viewGroup) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.view_in_storage_horizontal_view, null);
        viewGroup.addView(view);
    }

    public static void createDatePicker(BaseActivity activity, ViewGroup viewGroup, String name, boolean required, String text, String value, int id) {
        LayoutInflater inflater = LayoutInflater.from(activity);
        View view = inflater.inflate(R.layout.view_in_storage_textview, null);
        view.setId(id);
        TextView nameTextView = (TextView) view.findViewById(R.id.name);
        TextView textTextView = (TextView) view.findViewById(R.id.text);
        if (required) {
            String nameStr = name + "*";
            SpannableStringBuilder builder = new SpannableStringBuilder(nameStr);
            ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.RED);
            builder.setSpan(redSpan, nameStr.length() - 1, nameStr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            nameTextView.setText(builder);
        } else {
            nameTextView.setText(name);
        }
        textTextView.setText(text);
        textTextView.setOnClickListener(new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                getTimePickerDialog(activity, textTextView.getText().toString(), (TimePickerDialog timePickerView, long millseconds) -> {
                    textTextView.setText(Utils.getStringDateFromTimeStamp(UtilsConstant.YYYY_MM_DD, millseconds));
                }).show(activity.getSupportFragmentManager(), "datePicker");
            }
        });
        viewGroup.addView(view);
    }

    private static TimePickerDialog getTimePickerDialog(Context context, String time, OnDateSetListener onDateSetListener) {
        TimePickerDialog.Builder yearMonthDay = new TimePickerDialog.Builder()
                .setType(Type.YEAR_MONTH_DAY)
                .setThemeColor(ContextCompat.getColor(context, R.color.include_header_background))
                .setCallBack(onDateSetListener)
                .setTitleStringId(context.getResources().getString(R.string.common_select_date));
        if (time == null || "".equals(time)) {
            yearMonthDay.setCurrentMillseconds(System.currentTimeMillis());
        } else {
            yearMonthDay.setCurrentMillseconds(Utils.getTimeStampFromString(UtilsConstant.YYYY_MM_DD, time));
        }
        return yearMonthDay.build();
    }

    private static String getReceiveTextByValue(String value, List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean.SelectBean> selectList) {
        for (int i = 0; i < selectList.size(); i++) {
            InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean.SelectBean selectBean = selectList.get(i);
            if (selectBean.getValue().equals(value)) {
                return selectBean.getText();
            }
        }
        return "";
    }
    private static String getAllocatingTextByValue(String value, List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean.InfoBean> selectList) {
        for (int i = 0; i < selectList.size(); i++) {
            InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean.InfoBean selectBean = selectList.get(i);
            if (selectBean.getValue().equals(value)) {
                return selectBean.getText();
            }
        }
        return "";
    }
    private static String getFreeTextByValue(String value, List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean.InfoBean> selectList) {
        for (int i = 0; i < selectList.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean.InfoBean selectBean = selectList.get(i);
            if (selectBean.getValue().equals(value)) {
                return selectBean.getText();
            }
        }
        return "";
    }

    private static String getTenderTextByValue(String value, List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean.InfoBean> selectList) {
        for (int i = 0; i < selectList.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean.InfoBean selectBean = selectList.get(i);
            if (selectBean.getValue().equals(value)) {
                return selectBean.getText();
            }
        }
        return "";
    }

    private static String getOtherTextByValue(String value, List<InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean.InfoBean> selectList) {
        for (int i = 0; i < selectList.size(); i++) {
            InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean.InfoBean selectBean = selectList.get(i);
            if (selectBean.getValue().equals(value)) {
                return selectBean.getText();
            }
        }
        return "";
    }

    public static void createReceiveSelect(Context context, ViewGroup viewGroup, String name, boolean required, String text, String value, List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean.SelectBean> selectList, int id) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.view_in_storage_textview, null);
        view.setId(id);
        TextView nameTextView = (TextView) view.findViewById(R.id.name);
        TextView textTextView = (TextView) view.findViewById(R.id.text);
        TextView valueTextView = (TextView) view.findViewById(R.id.value);
        if (required) {
            String nameStr = name + "*";
            SpannableStringBuilder builder = new SpannableStringBuilder(nameStr);
            ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.RED);
            builder.setSpan(redSpan, nameStr.length() - 1, nameStr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            nameTextView.setText(builder);
        } else {
            nameTextView.setText(name);
        }
        textTextView.setText(getReceiveTextByValue(value, selectList));
        valueTextView.setText(value);
        textTextView.setOnClickListener(new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                DialogUtils.getReceiveSelectDialog(context, selectList, new DialogUtils.SelectListener() {
                    @Override
                    public void onSelect(Dialog dialog, String text, String value) {
                        textTextView.setText(text);
                        valueTextView.setText(value);
                    }
                }).show();
            }
        });
        viewGroup.addView(view);
    }

    //创建调拨入库选择框
    public static void createAllocatingSelect(Context context, ViewGroup viewGroup, String name, boolean required, String text, String value, List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean.InfoBean> selectList, int id) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.view_in_storage_textview, null);
        view.setId(id);
        TextView nameTextView = (TextView) view.findViewById(R.id.name);
        TextView textTextView = (TextView) view.findViewById(R.id.text);
        TextView valueTextView = (TextView) view.findViewById(R.id.value);
        if (required) {
            String nameStr = name + "*";
            SpannableStringBuilder builder = new SpannableStringBuilder(nameStr);
            ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.RED);
            builder.setSpan(redSpan, nameStr.length() - 1, nameStr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            nameTextView.setText(builder);
        } else {
            nameTextView.setText(name);
        }
        textTextView.setText(getAllocatingTextByValue(value, selectList));
        valueTextView.setText(value);
        textTextView.setOnClickListener(new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                DialogUtils.getAllocatingSelectDialog(context, selectList, new DialogUtils.SelectListener() {
                    @Override
                    public void onSelect(Dialog dialog, String text, String value) {
                        textTextView.setText(text);
                        valueTextView.setText(value);
                    }
                }).show();
            }
        });
        viewGroup.addView(view);
    }
    //创建免检入库下拉选择框
    public static void createFreeSelect(Context context, ViewGroup viewGroup, String name, boolean required, String text, String value, List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean.InfoBean> selectList, int id) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.view_in_storage_textview, null);
        view.setId(id);
        TextView nameTextView = (TextView) view.findViewById(R.id.name);
        TextView textTextView = (TextView) view.findViewById(R.id.text);
        TextView valueTextView = (TextView) view.findViewById(R.id.value);
        if (required) {
            String nameStr = name + "*";
            SpannableStringBuilder builder = new SpannableStringBuilder(nameStr);
            ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.RED);
            builder.setSpan(redSpan, nameStr.length() - 1, nameStr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            nameTextView.setText(builder);
        } else {
            nameTextView.setText(name);
        }
        textTextView.setText(getFreeTextByValue(value, selectList));
        valueTextView.setText(value);
        textTextView.setOnClickListener(new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                DialogUtils.getFreeSelectDialog(context, selectList, new DialogUtils.SelectListener() {
                    @Override
                    public void onSelect(Dialog dialog, String text, String value) {
                        textTextView.setText(text);
                        valueTextView.setText(value);
                    }
                }).show();
            }
        });
        viewGroup.addView(view);
    }



    //创建招采入库下拉选择框
    public static void createTenderSelect(Context context, ViewGroup viewGroup, String name, boolean required, String text, String value, List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean.InfoBean> selectList, int id) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.view_in_storage_textview, null);
        view.setId(id);
        TextView nameTextView = (TextView) view.findViewById(R.id.name);
        TextView textTextView = (TextView) view.findViewById(R.id.text);
        TextView valueTextView = (TextView) view.findViewById(R.id.value);
        if (required) {
            String nameStr = name + "*";
            SpannableStringBuilder builder = new SpannableStringBuilder(nameStr);
            ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.RED);
            builder.setSpan(redSpan, nameStr.length() - 1, nameStr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            nameTextView.setText(builder);
        } else {
            nameTextView.setText(name);
        }
        textTextView.setText(getTenderTextByValue(value, selectList));
        valueTextView.setText(value);
        textTextView.setOnClickListener(new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                DialogUtils.getTenderSelectDialog(context, selectList, new DialogUtils.SelectListener() {
                    @Override
                    public void onSelect(Dialog dialog, String text, String value) {
                        textTextView.setText(text);
                        valueTextView.setText(value);
                    }
                }).show();
            }
        });
        viewGroup.addView(view);
    }

    public static void createOtherSelect(Context context, ViewGroup viewGroup, String name, boolean required, String text, String value, List<InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean.InfoBean> selectList, int id) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.view_in_storage_textview, null);
        view.setId(id);
        TextView nameTextView = (TextView) view.findViewById(R.id.name);
        TextView textTextView = (TextView) view.findViewById(R.id.text);
        TextView valueTextView = (TextView) view.findViewById(R.id.value);
        if (required) {
            String nameStr = name + "*";
            SpannableStringBuilder builder = new SpannableStringBuilder(nameStr);
            ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.RED);
            builder.setSpan(redSpan, nameStr.length() - 1, nameStr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            nameTextView.setText(builder);
        } else {
            nameTextView.setText(name);
        }
        textTextView.setText(getOtherTextByValue(value, selectList));
        valueTextView.setText(value);
        textTextView.setOnClickListener(new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                DialogUtils.getOtherSelectDialog(context, selectList, new DialogUtils.SelectListener() {
                    @Override
                    public void onSelect(Dialog dialog, String text, String value) {
                        textTextView.setText(text);
                        valueTextView.setText(value);
                    }
                }).show();
            }
        });
        viewGroup.addView(view);
    }

    //通过序号获取验收入库行项目
    public static InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean getReceiveInStorageItemBySerial(Context context, String serial) {
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> receiveInStorageItemList = InStorageUtils.getInStorageReceiveOverviewBean(context).getData().getReceiveInStorageList();
        for (int i = 0; i < receiveInStorageItemList.size(); i++) {
            InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean item = receiveInStorageItemList.get(i);
            if (item.getSerial().equals(serial)) {
                return item;
            }
        }
        return null;
    }

    //通过序号获取免检入库行项目
    public static InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean getFreeInStorageItemBySerial(Context context, String serial) {
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> freeInStorageItemList = InStorageUtils.getInStorageFreeOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < freeInStorageItemList.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean item = freeInStorageItemList.get(i);
            if (item.getStock_input_rid().equals(serial)) {
                return item;
            }
        }
        return null;
    }

    //通过序号获取招采入库行项目
    public static InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean getTenderInStorageItemBySerial(Context context, String serial) {
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean > tenderInStorageItemList = InStorageUtils.getInStorageTenderOverviewBean(context).getBody().getItem_list();
        for (int i = 0; i < tenderInStorageItemList.size(); i++) {
            InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean  item = tenderInStorageItemList.get(i);
            if (item.getStock_input_rid().equals(serial)) {
                return item;
            }
        }
        return null;
    }

    //通过序号获取验收入库行项目
    public static InStorageOtherOverviewBean.MaterielListBean getOtherInStorageItemByMaterielCode(Context context, String materielCode) {
        List<InStorageOtherOverviewBean.MaterielListBean> otherInStorageItemList = InStorageUtils.getInStorageOtherBean(context).getMaterielList();
        for (int i = 0; i < otherInStorageItemList.size(); i++) {
            InStorageOtherOverviewBean.MaterielListBean item = otherInStorageItemList.get(i);
            if (item.getMat_code().equals(materielCode)) {
                return item;
            }
        }
        return null;
    }

    //更新验收入库行项目
    public static void updateReceiveInStorageItem(Context context, InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean materielItem) {
        InStorageReceiveOverviewBean bean = getInStorageReceiveOverviewBean(context);
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> receiveInstoragelist = bean.getData().getReceiveInStorageList();
        for (int i = 0; i < receiveInstoragelist.size(); i++) {
            InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean receiveInstorageItem = receiveInstoragelist.get(i);
            if (materielItem.getSerial().equals(receiveInstorageItem.getSerial())) {
                receiveInstoragelist.remove(receiveInstorageItem);
                receiveInstoragelist.add(i, materielItem);
                break;
            }
        }
        bean.getData().setReceiveInStorageList(receiveInstoragelist);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageReceiveOverviewBean.class);
        SPUtils.saveReceiveInStorageInformation(context, json);
    }
    //更新调拨入库行项目
    public static void updateAllocatingInStorageItem(Context context, InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean materielItem) {
        InStorageAllocatingOverviewBean bean = getInStorageAllocatingOverviewBean(context);
        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> receiveInstoragelist = bean.getBody().getItem_list();
        for (int i = 0; i < receiveInstoragelist.size(); i++) {
            InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean receiveInstorageItem = receiveInstoragelist.get(i);
            if (materielItem.getStock_input_rid().equals(receiveInstorageItem.getStock_input_rid())) {
                receiveInstoragelist.remove(receiveInstorageItem);
                receiveInstoragelist.add(i, materielItem);
                break;
            }
        }
        bean.getBody().setItem_list(receiveInstoragelist);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageAllocatingOverviewBean.class);
        SPUtils.saveAllocatingInStorageInformation(context, json);
    }
    //更新免检入库行项目
    public static void updateFreeInStorageItem(Context context, InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean materielItem) {
        InStorageFreeOverviewBean bean = getInStorageFreeOverviewBean(context);
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> freeInstoragelist = bean.getBody().getItem_list();
        for (int i = 0; i < freeInstoragelist.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean freeInstorageItem = freeInstoragelist.get(i);
            if (materielItem.getStock_input_rid().equals(freeInstorageItem.getStock_input_rid())) {
                freeInstoragelist.remove(freeInstorageItem);
                freeInstoragelist.add(i, materielItem);
                break;
            }
        }
        bean.getBody().setItem_list(freeInstoragelist);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageFreeOverviewBean.class);
        SPUtils.saveFreeInStorageInformation(context, json);
    }

    //更新招采入库行项目
    public static void updateTenderInStorageItem(Context context, InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean materielItem) {
        InStorageTenderOverviewBean bean = getInStorageTenderOverviewBean(context);
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> tenderInstoragelist = bean.getBody().getItem_list();
        for (int i = 0; i < tenderInstoragelist.size(); i++) {
            InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean tenderInstorageItem = tenderInstoragelist.get(i);
            if (materielItem.getStock_input_rid().equals(tenderInstorageItem.getStock_input_rid())) {
                tenderInstoragelist.remove(tenderInstorageItem);
                tenderInstoragelist.add(i, materielItem);
                break;
            }
        }
        bean.getBody().setItem_list(tenderInstoragelist);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageTenderOverviewBean.class);
        SPUtils.saveTenderInStorageInformation(context, json);
    }

    public static void updateOtherInStorageItem(Context context, InStorageOtherOverviewBean.MaterielListBean materielItem) {
        InStorageOtherBean bean = getInStorageOtherBean(context);
        List<InStorageOtherOverviewBean.MaterielListBean> otherInstoragelist = bean.getMaterielList();
        for (int i = 0; i < otherInstoragelist.size(); i++) {
            InStorageOtherOverviewBean.MaterielListBean otherInstorageItem = otherInstoragelist.get(i);
            if (materielItem.getMat_code().equals(otherInstorageItem.getMat_code())) {
                otherInstoragelist.remove(otherInstorageItem);
                otherInstoragelist.add(i, materielItem);
                break;
            }
        }
        bean.setMaterielList(otherInstoragelist);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageOtherBean.class);
        SPUtils.saveOtherInStorageInformation(context, json);
    }

    public static void updateFreeReason(Context context, String value) {
        InStorageFreeOverviewBean bean = getInStorageFreeOverviewBean(context);
        bean.getBody().setReason_id(value);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageFreeOverviewBean.class);
        SPUtils.saveFreeInStorageInformation(context, json);
    }

    public static String checkFreeReason(Context context) {
        InStorageFreeOverviewBean bean = getInStorageFreeOverviewBean(context);
        return bean.getBody().getReason_id();
    }

//    public static <T> T fromJson(String json, Class<T> className) {
//        String data = json.replace("\\", "");
//        Gson gson = new Gson();
//        T result = gson.fromJson(data, className);
//        return result;
//    }
//
//    public static <T> String toJson(T jsonBean, Class<T> className) {
//        Gson gson = new Gson();
//        String result = gson.toJson(jsonBean, className);
//        return result.replace("\"", "\\\"");
//    }

    //删除验收入库验收人
    public static void deleteReceiveOperator(Context context, String id) {
        InStorageReceiveOverviewBean bean = getInStorageReceiveOverviewBean(context);
        List<InStorageReceiveOverviewBean.DataBean.OperatorListBean> operatorList = bean.getData().getOperatorList();
        for (int i = 0; i < operatorList.size(); i++) {
            InStorageReceiveOverviewBean.DataBean.OperatorListBean operatorItem = operatorList.get(i);
            if (operatorItem.getId().equals(id)) {
                operatorList.remove(operatorItem);
                break;
            }
        }
        bean.getData().setOperatorList(operatorList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageReceiveOverviewBean.class);
        SPUtils.saveReceiveInStorageInformation(context, json);
    }
    //删除调拨入库验收人
    public static void deleteAllocatingOperator(Context context, String id) {
        InStorageAllocatingOverviewBean bean = getInStorageAllocatingOverviewBean(context);
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            GetOperatorBean.OperatorBean operatorItem = operatorList.get(i);
            if (operatorItem.getUser_id().equals(id)) {
                operatorList.remove(operatorItem);
                break;
            }
        }
        bean.getBody().setUser_list(operatorList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageAllocatingOverviewBean.class);
        SPUtils.saveAllocatingInStorageInformation(context, json);
    }
    //删除免检入库验收人
    public static void deleteFreeOperator(Context context, String id) {
        InStorageFreeOverviewBean bean = getInStorageFreeOverviewBean(context);
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            GetOperatorBean.OperatorBean operatorItem = operatorList.get(i);
            if (operatorItem.getUser_id().equals(id)) {
                operatorList.remove(operatorItem);
                break;
            }
        }
        bean.getBody().setUser_list(operatorList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageFreeOverviewBean.class);
        SPUtils.saveFreeInStorageInformation(context, json);
    }

    //删除其他入库验收人
    public static void deleteOtherOperator(Context context, String id) {
        InStorageOtherBean bean = getInStorageOtherBean(context);
        List<GetOperatorBean.OperatorBean> operatorList = bean.getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            GetOperatorBean.OperatorBean operatorItem = operatorList.get(i);
            if (operatorItem.getUser_id().equals(id)) {
                operatorList.remove(operatorItem);
                break;
            }
        }
        bean.setUser_list(operatorList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageOtherBean.class);
        SPUtils.saveOtherInStorageInformation(context, json);
    }
    //删除其他入库验收人
    public static void deleteTenderOperator(Context context, String id) {
        InStorageTenderOverviewBean bean = getInStorageTenderOverviewBean(context);
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            GetOperatorBean.OperatorBean operatorItem = operatorList.get(i);
            if (operatorItem.getUser_id().equals(id)) {
                operatorList.remove(operatorItem);
                break;
            }
        }
        bean.getBody().setUser_list(operatorList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageTenderOverviewBean.class);
        SPUtils.saveTenderInStorageInformation(context, json);
    }

    //删除其他入库物料信息
    public static void deleteOtherMateriel(Context context, String materielCode) {
        InStorageOtherBean bean = getInStorageOtherBean(context);
        List<InStorageOtherOverviewBean.MaterielListBean> list = bean.getMaterielList();
        for (int i = 0; i < list.size(); i++) {
            InStorageOtherOverviewBean.MaterielListBean materielItem = list.get(i);
            if (materielItem.getMat_code().equals(materielCode)) {
                list.remove(materielItem);
                break;
            }
        }
        bean.setMaterielList(list);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageOtherBean.class);
        SPUtils.saveOtherInStorageInformation(context, json);
    }

    //添加验收入库验收人
    public static void addReceiveOperator(Context context, InStorageReceiveOverviewBean.DataBean.OperatorListBean receiveItem) {
        InStorageReceiveOverviewBean bean = getInStorageReceiveOverviewBean(context);
        List<InStorageReceiveOverviewBean.DataBean.OperatorListBean> receiverList = bean.getData().getOperatorList();
        receiverList.add(0, receiveItem);
        bean.getData().setOperatorList(receiverList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageReceiveOverviewBean.class);
        SPUtils.saveReceiveInStorageInformation(context, json);
    }

    //添加调拨入库验收人
    public static void addAllocatingOperator(Context context, GetOperatorBean.OperatorBean receiveItem) {
        InStorageAllocatingOverviewBean bean = getInStorageAllocatingOverviewBean(context);
        List<GetOperatorBean.OperatorBean> receiverList = bean.getBody().getUser_list();
        receiverList.add(0, receiveItem);
        bean.getBody().setUser_list(receiverList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageAllocatingOverviewBean.class);
        SPUtils.saveAllocatingInStorageInformation(context, json);
    }

    //清空原验收入库验收人并添加选择用户组的入库验收人
    public static void addGroupReceiveOperator (Context context , List<InStorageReceiveOverviewBean.DataBean.OperatorListBean> list) {
        InStorageReceiveOverviewBean bean = getInStorageReceiveOverviewBean(context);
        bean.getData().setOperatorList(list);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageReceiveOverviewBean.class);
        SPUtils.saveReceiveInStorageInformation(context, json);
    }

    //清空原调拨如库验收人并添加选择用户组的入库验收人
    public static void addGroupRAlloctingOperator (Context context , List<GetOperatorBean.OperatorBean> list) {
        InStorageAllocatingOverviewBean bean = getInStorageAllocatingOverviewBean(context);
        bean.getBody().setUser_list(list);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageAllocatingOverviewBean.class);
        SPUtils.saveAllocatingInStorageInformation(context, json);
    }

    //清空原免检入库验收人并添加选择用户组的入库验收人
    public static void addGroupFreeAddOperator (Context context , List<GetOperatorBean.OperatorBean> list) {
        InStorageFreeOverviewBean bean = getInStorageFreeOverviewBean(context);
        bean.getBody().setUser_list(list);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageFreeOverviewBean.class);
        SPUtils.saveFreeInStorageInformation(context, json);
    }

    //清空原其它入库验收人并添加选择用户组的入库验收人
    public static void addGroupOtherAddOperator (Context context , List<GetOperatorBean.OperatorBean> list) {
        InStorageOtherBean bean = getInStorageOtherBean(context);
        bean.setUser_list(list);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageOtherBean.class);
        SPUtils.saveOtherInStorageInformation(context, json);
    }

    //清空原招采入库验收人并添加选择用户组的入库验收人
    public static void addGroupTenderAddOperator (Context context , List<GetOperatorBean.OperatorBean> list) {
        InStorageTenderOverviewBean bean = getInStorageTenderOverviewBean(context);
        bean.getBody().setUser_list(list);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageTenderOverviewBean.class);
        SPUtils.saveTenderInStorageInformation(context, json);
    }
    //通过验收入库用户组获取入库验收人列表
    public static List<InStorageReceiveOverviewBean.DataBean.OperatorListBean> getOperatorListByGroupList (Context context , List<InStorageReceiveAddOperatorUserGroupBean.DataBean.GroupListBean> groupListBeanList , String groupCodeStr) {
        List<InStorageReceiveOverviewBean.DataBean.OperatorListBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroupId().equals(groupCodeStr)) {
                List<InStorageOperatorBean.DataBean.ReceiverListBean> groupList = groupListBeanList.get(i).getReceiverList();
                for (int j = 0; j < groupList.size(); j++) {
                    InStorageOperatorBean.DataBean.ReceiverListBean receiverListBean = groupList.get(j);
                    InStorageReceiveOverviewBean.DataBean.OperatorListBean receiveReceiver = new InStorageReceiveOverviewBean.DataBean.OperatorListBean();
                    receiveReceiver.setId(receiverListBean.getId());
                    receiveReceiver.setName(receiverListBean.getName());
                    receiveReceiver.setDepartment(receiverListBean.getDepartment());
                    receiveReceiver.setRoleName(receiverListBean.getRoleName());
                    receiveReceiver.setRoleCode(receiverListBean.getRoleCode());
                    receiveReceiver.setPhone(receiverListBean.getPhone());
                    list.add(receiveReceiver);
                }
            }
        }

        return list;
    }
    //通过调拨入库用户组获取入库验收人列表
    public static List<GetOperatorBean.OperatorBean> getAllocatingOperatorListByGroupList (Context context , List<GetOperatorGroupBean.OperatorGroupBean> groupListBeanList , String groupCodeStr) {
        List<GetOperatorBean.OperatorBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroup_id().equals(groupCodeStr)) {
                List<GetOperatorBean.OperatorBean> groupList = groupListBeanList.get(i).getGroup_item_list();
                for (int j = 0; j < groupList.size(); j++) {
                    GetOperatorBean.OperatorBean receiverListBean = groupList.get(j);
                    GetOperatorBean.OperatorBean receiveReceiver = new GetOperatorBean.OperatorBean();
                    receiveReceiver.setUser_id(receiverListBean.getUser_id());
                    receiveReceiver.setUser_name(receiverListBean.getUser_name());
                    receiveReceiver.setOrg_name(receiverListBean.getOrg_name());
                    receiveReceiver.setRole_name(receiverListBean.getRole_name());
                    receiveReceiver.setRole_id(receiverListBean.getRole_id());
                    receiveReceiver.setMobile(receiverListBean.getMobile());
                    list.add(receiveReceiver);
                }
            }
        }

        return list;
    }

    //通过免检入库用户组获取入库验收人列表
    public static List<GetOperatorBean.OperatorBean> getFreeAddOperatorListByGroupList (Context context , List<GetOperatorGroupBean.OperatorGroupBean> groupListBeanList , String groupCodeStr) {
        List<GetOperatorBean.OperatorBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroup_id().equals(groupCodeStr)) {
                List<GetOperatorBean.OperatorBean> groupList = groupListBeanList.get(i).getGroup_item_list();
//                for (int j = 0; j < groupList.size(); j++) {
//                    GetOperatorBean.OperatorBean receiverListBean = groupList.get(j);
//                    InStorageFreeOverviewBean.OverviewBean.OperatorBean receiveReceiver = new InStorageFreeOverviewBean.OverviewBean.OperatorBean();
//                    receiveReceiver.setUser_id(receiverListBean.getId());
//                    receiveReceiver.setApply_user_name(receiverListBean.getName());
//                    receiveReceiver.setOrg_name(receiverListBean.getDepartment());
//                    receiveReceiver.setRole_name(receiverListBean.getRoleName());
//                    receiveReceiver.setRole_id(receiverListBean.getRoleCode());
//                    receiveReceiver.setMobile(receiverListBean.getPhone());
//                    list.add(receiveReceiver);
//                }
                list = groupList;
            }
        }

        return list;
    }

    //通过其它入库用户组获取入库验收人列表
    public static List<GetOperatorBean.OperatorBean> getOtherAddOperatorListByGroupList (Context context , List<GetOperatorGroupBean.OperatorGroupBean> groupListBeanList , String groupCodeStr) {
        List<GetOperatorBean.OperatorBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroup_id().equals(groupCodeStr)) {
                List<GetOperatorBean.OperatorBean> groupList = groupListBeanList.get(i).getGroup_item_list();
//                for (int j = 0; j < groupList.size(); j++) {
//                    InStorageOperatorBean.DataBean.ReceiverListBean receiverListBean = groupList.get(j);
//                    InStorageOtherBean.OperatorListBean receiveReceiver = new InStorageOtherBean.OperatorListBean();
//                    receiveReceiver.setId(receiverListBean.getId());
//                    receiveReceiver.setName(receiverListBean.getName());
//                    receiveReceiver.setDepartment(receiverListBean.getDepartment());
//                    receiveReceiver.setRoleName(receiverListBean.getRoleName());
//                    receiveReceiver.setRoleCode(receiverListBean.getRoleCode());
//                    receiveReceiver.setPhone(receiverListBean.getPhone());
//                    list.add(receiveReceiver);
//                }
                list = groupList;
            }
        }

        return list;
    }

    //通过招采入库用户组获取入库验收人列表
    public static List<GetOperatorBean.OperatorBean> getTenderAddOperatorListByGroupList (Context context , List<GetOperatorGroupBean.OperatorGroupBean> groupListBeanList , String groupCodeStr) {
        List<GetOperatorBean.OperatorBean> list = new ArrayList<>();
        for (int i = 0; i < groupListBeanList.size(); i++) {
            if (groupListBeanList.get(i).getGroup_id().equals(groupCodeStr)) {
                List<GetOperatorBean.OperatorBean> groupList = groupListBeanList.get(i).getGroup_item_list();
//                for (int j = 0; j < groupList.size(); j++) {
//                    InStorageOperatorBean.DataBean.ReceiverListBean receiverListBean = groupList.get(j);
//                    InStorageTenderOverviewBean.DataBean.OperatorListBean receiveReceiver = new InStorageTenderOverviewBean.DataBean.OperatorListBean();
//                    receiveReceiver.setId(receiverListBean.getId());
//                    receiveReceiver.setName(receiverListBean.getName());
//                    receiveReceiver.setDepartment(receiverListBean.getDepartment());
//                    receiveReceiver.setRoleName(receiverListBean.getRoleName());
//                    receiveReceiver.setRoleCode(receiverListBean.getRoleCode());
//                    receiveReceiver.setPhone(receiverListBean.getPhone());
//                    list.add(receiveReceiver);
//                }
                list = groupList;
            }
        }

        return list;
    }
    //添加免检入库验收人
    public static void addFreeOperator(Context context, GetOperatorBean.OperatorBean receiveItem) {
        InStorageFreeOverviewBean bean = getInStorageFreeOverviewBean(context);
        List<GetOperatorBean.OperatorBean> receiverList = bean.getBody().getUser_list();
        receiverList.add(0, receiveItem);
        bean.getBody().setUser_list(receiverList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageFreeOverviewBean.class);
        SPUtils.saveFreeInStorageInformation(context, json);
    }

    //添加招采入库验收人
    public static void addTenderOperator(Context context, GetOperatorBean.OperatorBean receiveItem) {
        InStorageTenderOverviewBean bean = getInStorageTenderOverviewBean(context);
        List<GetOperatorBean.OperatorBean> receiverList = bean.getBody().getUser_list();
        receiverList.add(0, receiveItem);
        bean.getBody().setUser_list(receiverList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageTenderOverviewBean.class);
        SPUtils.saveTenderInStorageInformation(context, json);
    }

    //添加其他入库验收人
    public static void addOtherOperator(Context context, GetOperatorBean.OperatorBean receiveItem) {
        InStorageOtherBean bean = getInStorageOtherBean(context);
        List<GetOperatorBean.OperatorBean> receiverList = bean.getUser_list();
        if (receiverList == null) {
            receiverList = new ArrayList<>();
        }
        receiverList.add(0, receiveItem);
        bean.setUser_list(receiverList);
        Gson gson = new Gson();
        String json = gson.toJson(bean, InStorageOtherBean.class);
        SPUtils.saveOtherInStorageInformation(context, json);
    }

    //是否有验收入库操作人员
    public static boolean hasReceiveOperator(Context context) {
        List<InStorageReceiveOverviewBean.DataBean.OperatorListBean> operatorList = getInStorageReceiveOverviewBean(context).getData().getOperatorList();
        if (operatorList != null && !operatorList.isEmpty()) {
            return true;
        }
        return false;
    }
    //是否有调拨入库操作人员
    public static boolean hasAllocatingOperator(Context context) {
        List<GetOperatorBean.OperatorBean> operatorList = getInStorageAllocatingOverviewBean(context).getBody().getUser_list();
        if (operatorList != null && !operatorList.isEmpty()) {
            return true;
        }
        return false;
    }
    //是否有免检入库操作人员
    public static boolean hasFreeOperator(Context context) {
        List<GetOperatorBean.OperatorBean> operatorList = getInStorageFreeOverviewBean(context).getBody().getUser_list();
        if (operatorList != null && !operatorList.isEmpty()) {
            return true;
        }
        return false;
    }

    //是否有招采入库操作人员
    public static boolean hasTenderOperator(Context context) {
        List<GetOperatorBean.OperatorBean> operatorList = getInStorageTenderOverviewBean(context).getBody().getUser_list();
        if (operatorList != null && !operatorList.isEmpty()) {
            return true;
        }
        return false;
    }

    //是否有其他入库操作人员
    public static boolean hasOtherOperator(Context context) {
        List<GetOperatorBean.OperatorBean> operatorList = getInStorageOtherBean(context).getUser_list();
        if (operatorList != null && !operatorList.isEmpty()) {
            return true;
        }
        return false;
    }

    //拼验收入库对象
    public static InStorageReceiveConfirmRequestBean getInStorageReceiveConfirmRequestBean(Context context, String voucherDate, String postDate, boolean isFocus) {
        InStorageReceiveConfirmRequestBean result = new InStorageReceiveConfirmRequestBean();
        InStorageReceiveOverviewBean bean = getInStorageReceiveOverviewBean(context);
        result.setInStorageNumber(bean.getData().getInStorageNumber());
        result.setVoucherDate(voucherDate);
        result.setPostDate(postDate);
        result.setIsFocus(isFocus ? IS_FOCUS_TRUE : IS_FOCUS_FALSE);
        //操作人
        List<InStorageReceiveConfirmRequestBean.OperatorListBean> resultOperatorList = new ArrayList<>();
        List<InStorageReceiveOverviewBean.DataBean.OperatorListBean> operatorList = bean.getData().getOperatorList();
        for (int i = 0; i < operatorList.size(); i++) {
            InStorageReceiveConfirmRequestBean.OperatorListBean operator = new InStorageReceiveConfirmRequestBean.OperatorListBean();
            operator.setRoleCode(operatorList.get(i).getRoleCode());
            operator.setId(operatorList.get(i).getId());
            resultOperatorList.add(operator);
        }
        result.setOperatorList(resultOperatorList);
        //物料
        List<InStorageReceiveConfirmRequestBean.MaterielListBean> resultMaterielList = new ArrayList<>();
        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> receiveInStorageList = bean.getData().getReceiveInStorageList();
        for (int i = 0; i < receiveInStorageList.size(); i++) {
            InStorageReceiveConfirmRequestBean.MaterielListBean resultMateriel = new InStorageReceiveConfirmRequestBean.MaterielListBean();
            InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean receiveInStorage = receiveInStorageList.get(i);
            resultMateriel.setSerial(receiveInStorage.getSerial());
            resultMateriel.setInventoryAddressCode(receiveInStorage.getInventoryAddressCode());
            resultMateriel.setFactoryCode(receiveInStorage.getFactoryCode());
            resultMateriel.setInStorageNumber(TextUtils.isEmpty(receiveInStorage.getRealInStorageNumber()) ? receiveInStorage.getInStorageNumber() : receiveInStorage.getRealInStorageNumber());
            resultMateriel.setBatchId(receiveInStorage.getBatchId());
            List<InStorageReceiveConfirmRequestBean.MaterielListBean.BatchListBean> resultBatchList = new ArrayList<>();
            List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean> batchList = receiveInStorage.getBatch();
            for (int j = 0; j < batchList.size(); j++) {
                InStorageReceiveConfirmRequestBean.MaterielListBean.BatchListBean resultBatch = new InStorageReceiveConfirmRequestBean.MaterielListBean.BatchListBean();
                InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean batch = batchList.get(j);
                resultBatch.setId(batch.getId());
                resultBatch.setType(batch.getType());
                resultBatch.setText(batch.getText());
                resultBatch.setValue(batch.getValue());
                resultBatchList.add(resultBatch);
            }
            resultMateriel.setBatchList(resultBatchList);
            resultMaterielList.add(resultMateriel);
        }
        result.setMaterielList(resultMaterielList);
        return result;
    }
    //拼调拨入库对象
    public static InStorageAllocatingConfirmRequestBean getInStorageAllocatingConfirmRequestBean(Context context, String voucherDate, String postDate, boolean isFocus) {
        InStorageAllocatingConfirmRequestBean result = new InStorageAllocatingConfirmRequestBean();
        InStorageAllocatingOverviewBean bean = getInStorageAllocatingOverviewBean(context);
//        result.setVoucherDate(voucherDate);
//        result.setPostDate(postDate);
        result.setAllocate_id(TextUtils.isEmpty(bean.getBody().getAllocate_id()) ? null : bean.getBody().getAllocate_id());
        result.setAllocate_delivery_id(TextUtils.isEmpty(bean.getBody().getAllocate_delivery_id()) ? null :bean.getBody().getAllocate_delivery_id());
        if (!TextUtils.isEmpty(bean.getBody().getInStorageNumber()) && !TextUtils.isEmpty(bean.getBody().getStock_input_id())) {
            result.setStock_input_code(TextUtils.isEmpty(bean.getBody().getInStorageNumber()) ? null : bean.getBody().getInStorageNumber());
            result.setStock_input_id(TextUtils.isEmpty(bean.getBody().getStock_input_id()) ? null : bean.getBody().getStock_input_id());
        }
//        result.setInStorageNumber(TextUtils.isEmpty(bean.getData().getInStorageNumber())?"":bean.getData().getInStorageNumber());
//        result.setIsFocus(isFocus ? IS_FOCUS_TRUE : IS_FOCUS_FALSE);
        //操作人
        List<InStorageAllocatingConfirmRequestBean.UserListBean> resultOperatorList = new ArrayList<>();
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            InStorageAllocatingConfirmRequestBean.UserListBean operator = new InStorageAllocatingConfirmRequestBean.UserListBean();
            operator.setRole_id(operatorList.get(i).getRole_id());
            operator.setUser_id(operatorList.get(i).getUser_id());
            resultOperatorList.add(operator);
        }
        result.setUser_list(resultOperatorList);
        //物料
        List<InStorageAllocatingConfirmRequestBean.ItemListBean> resultMaterielList = new ArrayList<>();
        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> receiveInStorageList = bean.getBody().getItem_list();
        int inputRid = 1;
        for (int i = 0; i < receiveInStorageList.size(); i++) {
            InStorageAllocatingConfirmRequestBean.ItemListBean resultMateriel = new InStorageAllocatingConfirmRequestBean.ItemListBean();
            InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean receiveInStorage = receiveInStorageList.get(i);
            resultMateriel.setStock_input_rid(inputRid + "");
            resultMateriel.setAllocate_item_id(receiveInStorage.getAllocate_item_id());
            List<InStorageAllocatingConfirmRequestBean.ItemListBean.BatchMaterialSpecListBean> resultBatchList = new ArrayList<>();
            List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchMaterialSpecListBean> batchList = receiveInStorage.getBatch_material_spec_list();
            for (int j = 0; j < batchList.size(); j++) {
                InStorageAllocatingConfirmRequestBean.ItemListBean.BatchMaterialSpecListBean resultBatch = new InStorageAllocatingConfirmRequestBean.ItemListBean.BatchMaterialSpecListBean();
                InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchMaterialSpecListBean batch = batchList.get(j);
                resultBatch.setBatch_spec_code(batch.getBatch_spec_code());
                resultBatch.setBatch_spec_value(batch.getText());
                resultBatchList.add(resultBatch);
            }
            List<InStorageAllocatingConfirmRequestBean.ItemListBean.BatchSpecListBean> resultBatchList1 = new ArrayList<>();
            List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean> batchList1 = receiveInStorage.getBatch_spec_list();
            for (int j = 0; j < batchList1.size(); j++) {
                InStorageAllocatingConfirmRequestBean.ItemListBean.BatchSpecListBean resultBatch = new InStorageAllocatingConfirmRequestBean.ItemListBean.BatchSpecListBean();
                InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean batch = batchList1.get(j);
                resultBatch.setBatch_spec_code(batch.getBatch_spec_code());
                resultBatch.setBatch_spec_value(batch.getText());
                resultBatchList1.add(resultBatch);
            }
            resultMateriel.setBatch_spec_list(resultBatchList1);
            resultMateriel.setBatch_material_spec_list(resultBatchList);
            resultMaterielList.add(resultMateriel);
            inputRid += 1;
        }
        result.setItem_list(resultMaterielList);
        return result;
    }
    //拼免检入库对象
    public static InStorageFreeConfirmRequestBean getInStorageFreeConfirmRequestBean(Context context, String voucherDate, String postDate, boolean isFocus) {
        InStorageFreeConfirmRequestBean result = new InStorageFreeConfirmRequestBean();
        InStorageFreeOverviewBean bean = getInStorageFreeOverviewBean(context);
        result.setStock_input_id(bean.getBody().getInStorageNumber());
        result.setExempt_check(bean.getBody().getReason_id());
        result.setPurchase_order_code(bean.getBody().getPurchase_order_code());
//        result.setVoucherDate(voucherDate);
//        result.setPostDate(postDate);
//        result.setIsFocus(isFocus ? IS_FOCUS_TRUE : IS_FOCUS_FALSE);
        if (!TextUtils.isEmpty(bean.getBody().getInStorageNumber()) && !TextUtils.isEmpty(bean.getBody().getStock_input_id())) {
            result.setStock_input_code(TextUtils.isEmpty(bean.getBody().getInStorageNumber()) ? null : bean.getBody().getPurchase_order_code());
            result.setStock_input_id(TextUtils.isEmpty(bean.getBody().getStock_input_id()) ? null : bean.getBody().getStock_input_id());
        }
        //操作人
        List<InStorageFreeConfirmRequestBean.UserListBean> resultOperatorList = new ArrayList<>();
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            InStorageFreeConfirmRequestBean.UserListBean operator = new InStorageFreeConfirmRequestBean.UserListBean();
            operator.setRole_id(operatorList.get(i).getRole_id());
            operator.setUser_id(operatorList.get(i).getUser_id());
            resultOperatorList.add(operator);
        }
        result.setUser_list(resultOperatorList);
        //物料
        List<InStorageFreeConfirmRequestBean.StockInputItemListBean> resultMaterielList = new ArrayList<>();
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> freeInStorageList = bean.getBody().getItem_list();
        int inputRid = 1;
        for (int i = 0; i < freeInStorageList.size(); i++) {
            if (!TextUtils.isEmpty(freeInStorageList.get(i).getInStorageNumber())) {
                InStorageFreeConfirmRequestBean.StockInputItemListBean resultMateriel = new InStorageFreeConfirmRequestBean.StockInputItemListBean();
                InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean freeInStorage = freeInStorageList.get(i);
                resultMateriel.setStock_input_rid(inputRid + "");
                resultMateriel.setLocation_id(freeInStorage.getLocation_id());
                LogUtils.i("getLocation_id === " + freeInStorage.getLocation_id());
                resultMateriel.setFty_id(freeInStorage.getFty_id());
                resultMateriel.setQty(freeInStorage.getInStorageNumber());
                resultMateriel.setPurchase_order_rid(freeInStorage.getPurchase_order_rid());
                List<InStorageFreeConfirmRequestBean.StockInputItemListBean.BatchMaterialSpecListBean> resultBatchList = new ArrayList<>();
                List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean> batchList = freeInStorage.getBatch_material_spec_list();
                for (int j = 0; j < batchList.size(); j++) {
                    InStorageFreeConfirmRequestBean.StockInputItemListBean.BatchMaterialSpecListBean resultBatch = new InStorageFreeConfirmRequestBean.StockInputItemListBean.BatchMaterialSpecListBean();
                    InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean batch = batchList.get(j);
                    resultBatch.setBatch_spec_code(batch.getBatch_spec_code());
    //                resultBatch.setType(batch.getType());
    //                resultBatch.setText(batch.getText());
                    resultBatch.setBatch_spec_value(batch.getText());
                    resultBatchList.add(resultBatch);
                }
                List<InStorageFreeConfirmRequestBean.StockInputItemListBean.BatchSpecListBean> batchSpecListBeanList = new ArrayList<>();
                List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> batchMaterialSpecList = freeInStorage.getBatch_spec_list();
                for (int j = 0; j < batchMaterialSpecList.size(); j++) {
                    InStorageFreeConfirmRequestBean.StockInputItemListBean.BatchSpecListBean resultBatch = new InStorageFreeConfirmRequestBean.StockInputItemListBean.BatchSpecListBean();
                    InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean batch = batchMaterialSpecList.get(j);
                    resultBatch.setBatch_spec_code(batch.getBatch_spec_code());
    //                resultBatch.setType(batch.getType());
    //                resultBatch.setText(batch.getText());
                    resultBatch.setBatch_spec_value(batch.getText());
                    batchSpecListBeanList.add(resultBatch);
                }
                resultMateriel.setBatch_spec_list(batchSpecListBeanList);
                resultMateriel.setBatch_material_spec_list(resultBatchList);
                resultMaterielList.add(resultMateriel);
                inputRid += 1;
            }
        }
        result.setItem_list(resultMaterielList);
        return result;
    }

    //拼招采入库对象
    public static InStorageTenderConfirmRequestBean getInStorageTenderConfirmRequestBean(Context context, String voucherDate, String postDate, boolean isFocus) {
        InStorageTenderConfirmRequestBean result = new InStorageTenderConfirmRequestBean();
        InStorageTenderOverviewBean bean = getInStorageTenderOverviewBean(context);
//        result.setStock_input_id(bean.getBody().getInStorageNumber());
//        result.setReaseon(bean.getData().getReaseonValue());
        result.setPurchase_order_code(bean.getBody().getPurchase_order_code());
//        result.setVoucherDate(voucherDate);
//        result.setPostDate(postDate);
//        result.setIsFocus(isFocus ? IS_FOCUS_TRUE : IS_FOCUS_FALSE);
        if (!TextUtils.isEmpty(bean.getBody().getInStorageNumber()) && !TextUtils.isEmpty(bean.getBody().getStock_input_id())) {
            result.setStock_input_code(TextUtils.isEmpty(bean.getBody().getInStorageNumber()) ? null : bean.getBody().getPurchase_order_code());
            result.setStock_input_id(TextUtils.isEmpty(bean.getBody().getStock_input_id()) ? null : bean.getBody().getStock_input_id());
        }
        //操作人
        List<InStorageTenderConfirmRequestBean.UserListBean> resultOperatorList = new ArrayList<>();
        List<GetOperatorBean.OperatorBean> operatorList = bean.getBody().getUser_list();
        for (int i = 0; i < operatorList.size(); i++) {
            InStorageTenderConfirmRequestBean.UserListBean operator = new InStorageTenderConfirmRequestBean.UserListBean();
            operator.setUser_id(operatorList.get(i).getUser_id());
            operator.setRole_id(operatorList.get(i).getRole_id());
            resultOperatorList.add(operator);
        }
        result.setUser_list(resultOperatorList);
        //物料
        List<InStorageTenderConfirmRequestBean.StockInputItemListBean> resultMaterielList = new ArrayList<>();
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> tenderInStorageList = bean.getBody().getItem_list();
        int inputRid = 1;
        for (int i = 0; i < tenderInStorageList.size(); i++) {
            if (!TextUtils.isEmpty(tenderInStorageList.get(i).getInStorageNumber())) {
                InStorageTenderConfirmRequestBean.StockInputItemListBean resultMateriel = new InStorageTenderConfirmRequestBean.StockInputItemListBean();
                InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean tenderInStorage = tenderInStorageList.get(i);
                resultMateriel.setStock_input_rid(inputRid + "");
                resultMateriel.setPurchase_order_rid(tenderInStorage.getPurchase_order_rid());
                resultMateriel.setLocation_id(tenderInStorage.getLocation_id());
                resultMateriel.setFty_id(tenderInStorage.getFty_id());
                resultMateriel.setQty(tenderInStorage.getInStorageNumber());
                resultMateriel.setLocation_id(tenderInStorage.getLocation_id());
                List<InStorageTenderConfirmRequestBean.StockInputItemListBean.BatchMaterialSpecListBean> resultBatchList = new ArrayList<>();
                List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean> batchList = tenderInStorage.getBatch_material_spec_list();
                for (int j = 0; j < batchList.size(); j++) {
                    InStorageTenderConfirmRequestBean.StockInputItemListBean.BatchMaterialSpecListBean resultBatch = new InStorageTenderConfirmRequestBean.StockInputItemListBean.BatchMaterialSpecListBean();
                    InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean batch = batchList.get(j);
                    resultBatch.setBatch_spec_code(batch.getBatch_spec_code());
//                resultBatch.setType(batch.getType());
//                resultBatch.setText(batch.getText());
                    resultBatch.setBatch_spec_value(batch.getText());
                    resultBatchList.add(resultBatch);
                }
                List<InStorageTenderConfirmRequestBean.StockInputItemListBean.BatchSpecListBean> resultBatchList1 = new ArrayList<>();
                List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> batchList1 = tenderInStorage.getBatch_spec_list();
                for (int j = 0; j < batchList1.size(); j++) {
                    InStorageTenderConfirmRequestBean.StockInputItemListBean.BatchSpecListBean resultBatch = new InStorageTenderConfirmRequestBean.StockInputItemListBean.BatchSpecListBean();
                    InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean batch = batchList1.get(j);
                    resultBatch.setBatch_spec_code(batch.getBatch_spec_code());
//                resultBatch.setType(batch.getType());
//                resultBatch.setText(batch.getText());
                    resultBatch.setBatch_spec_value(batch.getText());
                    resultBatchList1.add(resultBatch);
                }
                resultMateriel.setBatch_spec_list(resultBatchList1);
                resultMateriel.setBatch_material_spec_list(resultBatchList);

                resultMaterielList.add(resultMateriel);
                inputRid += 1;
            }

        }
        result.setItem_list(resultMaterielList);
        return result;
    }

    //拼其它入库对象
    public static InStorageOtherConfirmRequestBean getInStorageOtherConfirmRequestBean(Context context, String voucherDate, String postDate, boolean isFocus) {
        InStorageOtherConfirmRequestBean result = new InStorageOtherConfirmRequestBean();
        InStorageOtherBean bean = getInStorageOtherBean(context);
        if (!TextUtils.isEmpty(bean.getInStorageNumber()) && !TextUtils.isEmpty(bean.getStock_input_id())) {
            result.setStock_input_code(TextUtils.isEmpty(bean.getInStorageNumber()) ? null : bean.getInStorageNumber());
            result.setStock_input_id(TextUtils.isEmpty(bean.getStock_input_id()) ? null : bean.getStock_input_id());
        }
//        result.setVoucherDate(voucherDate);
//        result.setPostDate(postDate);
        result.setFty_id(bean.getFty_id());
//        result.setFactoryValue(bean.getFactoryValue());
        result.setLocation_id(bean.getLocation_id());
//        result.setInventoryAddressValue(bean.getInventoryAddressValue());
        result.setMove_type_id(bean.getMove_type_id());
//        result.setSpecialInventory(bean.getSpecialInventory());
//        result.setMoveDescription(bean.getMoveDescription());
        result.setReason_id(bean.getReason_id());
//        result.setInStorageReasonValue(bean.getInStorageReasonValue());
        result.setSupplier_code(bean.getSupplierCode());
        result.setSupplier_name(bean.getSupplierDescription());
        result.setSpec_stock_code(bean.getSpecialInventoryCode());
//        result.setSpecialInventoryDescription(bean.getSpecialInventoryDescription());
//        result.setIsFocus(isFocus ? IS_FOCUS_TRUE : IS_FOCUS_FALSE);
        //操作人
        List<InStorageOtherConfirmRequestBean.UserListBean> resultOperatorList = new ArrayList<>();
        List<GetOperatorBean.OperatorBean> operatorList = bean.getUser_list();
        int inputRid = 1;
        for (int i = 0; i < operatorList.size(); i++) {
            InStorageOtherConfirmRequestBean.UserListBean operator = new InStorageOtherConfirmRequestBean.UserListBean();
            operator.setUser_id(operatorList.get(i).getUser_id());
            operator.setRole_id(operatorList.get(i).getRole_id());
            resultOperatorList.add(operator);
        }
        result.setUser_list(resultOperatorList);
        //物料
        List<InStorageOtherConfirmRequestBean.StockInputItemListBean> resultMaterielList = new ArrayList<>();
        List<InStorageOtherOverviewBean.MaterielListBean> otherInstorageList = bean.getMaterielList();
        for (int i = 0; i < otherInstorageList.size(); i++) {
            if (!TextUtils.isEmpty(otherInstorageList.get(i).getInStorageNumber())) {
                InStorageOtherOverviewBean.MaterielListBean otherInStorage = otherInstorageList.get(i);
                InStorageOtherConfirmRequestBean.StockInputItemListBean resultMateriel = new InStorageOtherConfirmRequestBean.StockInputItemListBean();
                resultMateriel.setMat_id(otherInStorage.getMat_id());
                resultMateriel.setStock_input_rid(inputRid + "");
//            resultMateriel.setMaterielDescription(otherInStorage.getMaterielDescription());
                resultMateriel.setQty(otherInStorage.getInStorageNumber());
                resultMateriel.setUnit_id(otherInStorage.getUnit_id());
//            resultMateriel.setUnitCode(otherInStorage.getUnitCode());
//            resultMateriel.setBatchId(otherInStorage.getBatchId());

                List<InStorageOtherConfirmRequestBean.StockInputItemListBean.BatchMaterialSpecListBean> resultBatchList = new ArrayList<>();
                List<InStorageOtherOverviewBean.MaterielListBean.BatchMaterialSpecListBean> batchList = otherInStorage.getBatch_material_spec_list();
                for (int j = 0; j < batchList.size(); j++) {
                    InStorageOtherConfirmRequestBean.StockInputItemListBean.BatchMaterialSpecListBean resultBatch = new InStorageOtherConfirmRequestBean.StockInputItemListBean.BatchMaterialSpecListBean();
                    InStorageOtherOverviewBean.MaterielListBean.BatchMaterialSpecListBean batch = batchList.get(j);
                    resultBatch.setBatch_spec_code(batch.getBatch_spec_code());
                    resultBatch.setBatch_spec_value(batch.getText());
//                resultBatch.setText(batch.getText());
//                resultBatch.setValue(batch.getValue());
                    resultBatchList.add(resultBatch);
                }
                List<InStorageOtherConfirmRequestBean.StockInputItemListBean.BatchSpecListBean> resultBatchList1 = new ArrayList<>();
                List<InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean> batchList1 = otherInStorage.getBatch_spec_list();
                for (int j = 0; j < batchList1.size(); j++) {
                    InStorageOtherConfirmRequestBean.StockInputItemListBean.BatchSpecListBean resultBatch1 = new InStorageOtherConfirmRequestBean.StockInputItemListBean.BatchSpecListBean();
                    InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean batch1 = batchList1.get(j);
                    resultBatch1.setBatch_spec_code(batch1.getBatch_spec_code());
                    resultBatch1.setBatch_spec_value(batch1.getText());
//                resultBatch.setText(batch.getText());
//                resultBatch.setValue(batch.getValue());
                    resultBatchList1.add(resultBatch1);
                }
                resultMateriel.setBatch_material_spec_list(resultBatchList);
                resultMateriel.setBatch_spec_list(resultBatchList1);
                resultMaterielList.add(resultMateriel);
                inputRid += 1;
            }

        }
        result.setItem_list(resultMaterielList);
        return result;
    }

    public static void updateFreeInStorageNumber(Context context, String inStorageNumber , String id) {
        InStorageFreeOverviewBean bean = getInStorageFreeOverviewBean(context);
        bean.getBody().setInStorageNumber(inStorageNumber);
        bean.getBody().setStock_input_id(id);
        saveInStorageFreeOverviewBean(context, bean);
    }

    public static void updateOtherInStorageNumber(Context context, String inStorageNumber ,String id) {
        InStorageOtherBean bean = getInStorageOtherBean(context);
        bean.setInStorageNumber(inStorageNumber);
        bean.setStock_input_id(id);
        saveInStorageOtherBean(context, bean);
    }
    public static void updateAllocatingInStorageNumber(Context context, String inStorageNumber , String id) {
        InStorageAllocatingOverviewBean bean = getInStorageAllocatingOverviewBean(context);
        bean.getBody().setInStorageNumber(inStorageNumber);
        bean.getBody().setStock_input_id(id);
        Gson gson = new Gson();
        SPUtils.saveAllocatingInStorageInformation(context, gson.toJson(bean, InStorageAllocatingOverviewBean.class));
    }
    public static void updateTenderInStorageNumber(Context context, String inStorageNumber , String id) {
        InStorageTenderOverviewBean bean = getInStorageTenderOverviewBean(context);
        bean.getBody().setInStorageNumber(inStorageNumber);
        bean.getBody().setStock_input_id(id);
        saveInStorageTenderOverviewBean(context, bean);
    }

    public static boolean checkReceiveItem(InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean receiveInStorageItem) {
        if (TextUtils.isEmpty(receiveInStorageItem.getInStorageNumber())) {
            return false;
        } else {
            if (Double.parseDouble(receiveInStorageItem.getInStorageNumber()) == 0) {
                return false;
            }
        }

        List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean> batchList = receiveInStorageItem.getBatch();
        for (int j = 0; j < batchList.size(); j++) {
            InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean.BatchBean batchBean = batchList.get(j);
            if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getValue())) {
                    return false;
                }
            }
        }
        return true;
    }
    //检查调拨入库行项目是否填完
    public static boolean checkAllocatingItem(InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean allocatingStorageListBeanInStorageItem) {
//        if (TextUtils.isEmpty(receiveInStorageItem.getInStorageNumber())) {
//            return false;
//        } else {
//            if (Double.parseDouble(receiveInStorageItem.getInStorageNumber()) == 0) {
//                return false;
//            }
//        }

        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchMaterialSpecListBean> batchList = allocatingStorageListBeanInStorageItem.getBatch_material_spec_list();
        for (int j = 0; j < batchList.size(); j++) {
            InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchMaterialSpecListBean batchBean = batchList.get(j);
            if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                    return false;
                }
            }
        }
        List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean> batchList1 = allocatingStorageListBeanInStorageItem.getBatch_spec_list();
        for (int j = 0; j < batchList1.size(); j++) {
            InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean.BatchSpecListBean batchBean = batchList1.get(j);
            if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                    return false;
                }
            }
        }
        return true;
    }
    //检查免检入库行项目是否填完
    public static boolean checkFreeItem(InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean freeInStorageItem) {
        if (TextUtils.isEmpty(freeInStorageItem.getInStorageNumber())) {
            return false;
        } else {
            if (Double.parseDouble(freeInStorageItem.getInStorageNumber()) == 0) {
                return false;
            }
        }

        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean> batchList = freeInStorageItem.getBatch_material_spec_list();
        for (int j = 0; j < batchList.size(); j++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean  batchBean = batchList.get(j);
            if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                    return false;
                }
            }
        }
        List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> batchMaterialSpecList = freeInStorageItem.getBatch_spec_list();
        for (int j = 0; j < batchMaterialSpecList.size(); j++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean.BatchSpecListBean  batchMaterialSpecListBean = batchMaterialSpecList.get(j);
            if (REQUIRED_TRUE.equals(batchMaterialSpecListBean.getRequired())) {
                if (TextUtils.isEmpty(batchMaterialSpecListBean.getText()) && TextUtils.isEmpty(batchMaterialSpecListBean.getBatch_spec_value())) {
                    return false;
                }
            }
        }
        return true;
    }

    //检查招采入库行项目是否填完
    public static boolean checkTenderItem(InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean tenderInStorageItem) {
        if (TextUtils.isEmpty(tenderInStorageItem.getInStorageNumber())) {
            return false;
        } else {
            if (Double.parseDouble(tenderInStorageItem.getInStorageNumber()) == 0) {
                return false;
            }
        }

        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean> batchList = tenderInStorageItem.getBatch_material_spec_list();
        for (int j = 0; j < batchList.size(); j++) {
            InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchMaterialSpecListBean batchBean = batchList.get(j);
            if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                    return false;
                }
            }
        }
        List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean> batchMaterialSpecList = tenderInStorageItem.getBatch_spec_list();
        for (int j = 0; j < batchMaterialSpecList.size(); j++) {
            InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean.BatchSpecListBean  batchMaterialSpecListBean = batchMaterialSpecList.get(j);
            if (REQUIRED_TRUE.equals(batchMaterialSpecListBean.getRequired())) {
                if (TextUtils.isEmpty(batchMaterialSpecListBean.getText()) && TextUtils.isEmpty(batchMaterialSpecListBean.getBatch_spec_value())) {
                    return false;
                }
            }
        }
        return true;
    }

    public static boolean checkOtherItem(InStorageOtherOverviewBean.MaterielListBean otherInStorageItem) {
        if (TextUtils.isEmpty(otherInStorageItem.getInStorageNumber())) {
            return false;
        } else {
            if (Double.parseDouble(otherInStorageItem.getInStorageNumber()) == 0) {
                return false;
            }
        }

        List<InStorageOtherOverviewBean.MaterielListBean.BatchMaterialSpecListBean> batchList = otherInStorageItem.getBatch_material_spec_list();
        for (int j = 0; j < batchList.size(); j++) {
            InStorageOtherOverviewBean.MaterielListBean.BatchMaterialSpecListBean batchBean = batchList.get(j);
            if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                    return false;
                }
            }
        }
        List<InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean> batchMaterialSpecList = otherInStorageItem.getBatch_spec_list();
        for (int j = 0; j < batchMaterialSpecList.size(); j++) {
            InStorageOtherOverviewBean.MaterielListBean.BatchSpecListBean batchBean = batchMaterialSpecList.get(j);
            if (REQUIRED_TRUE.equals(batchBean.getRequired())) {
                if (TextUtils.isEmpty(batchBean.getText()) && TextUtils.isEmpty(batchBean.getBatch_spec_value())) {
                    return false;
                }
            }
        }
        return true;
    }

    //获取验收入库行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithReceiveInSorageList(List<InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            InStorageReceiveOverviewBean.DataBean.ReceiveInStorageListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getInStorageNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMaterielDescription());
                overItem.setNumber(materielItem.getRealInStorageNumber() + materielItem.getUnit());
                resultList.add(overItem);
            }
        }
        return resultList;
    }

    //获取调拨入库行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithAllocatingInSorageList(List<InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            InStorageAllocatingOverviewBean.ReceiveInAllocatingStorageListBean.StockInputItemBean materielItem = materielList.get(i);
//            if (!TextUtils.isEmpty(materielItem.getInStorageNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMat_name());
                overItem.setNumber(materielItem.getQty() + materielItem.getName_zh());
                resultList.add(overItem);
//            }
        }
        return resultList;
    }

    //获取免检入库行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithFreeInSorageList(List<InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            InStorageFreeOverviewBean.OverviewBean.PurchaseOrderItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getInStorageNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMat_name());
                overItem.setNumber(materielItem.getInStorageNumber() + materielItem.getName_zh());
                resultList.add(overItem);
            }
        }
        return resultList;
    }

    //获取其他入库行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithOtherInSorageList(List<InStorageOtherOverviewBean.MaterielListBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            InStorageOtherOverviewBean.MaterielListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getInStorageNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMat_name());
                overItem.setNumber(materielItem.getInStorageNumber() + materielItem.getName_zh());
                resultList.add(overItem);
            }
        }
        return resultList;
    }

    //获取招采入库行项目概览
    public static List<OverviewAdapter.OverviewBean> getOverViewBeanWithTenderInSorageList(List<InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean> materielList) {
        List<OverviewAdapter.OverviewBean> resultList = new ArrayList<>();
        for (int i = 0; i < materielList.size(); i++) {
            InStorageTenderOverviewBean.TenderInStorageOverviewBean.PurchaseOrderItemListBean materielItem = materielList.get(i);
            if (!TextUtils.isEmpty(materielItem.getInStorageNumber())) {
                OverviewAdapter.OverviewBean overItem = new OverviewAdapter.OverviewBean();
                overItem.setInfo(materielItem.getMat_name());
                overItem.setNumber(materielItem.getInStorageNumber() + materielItem.getName_zh());
                resultList.add(overItem);
            }
        }
        return resultList;
    }

    //拼接获取调拨单列表请求bean
    public static InStorageAllocatingGetListRequestBean getAllocatingGetListRequestBean (String condition) {
        InStorageAllocatingGetListRequestBean bean = new InStorageAllocatingGetListRequestBean();
        bean.setCondition(condition);
        bean.setPage_index("1");
        bean.setPage_size("1");
        return bean;
    }
}
